﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;

namespace Steve
{
    [DataContract]
    public enum LogEventType
    {
        [EnumMember]
        Critical = 3,
        [EnumMember]
        Error = 2,
        [EnumMember]
        Warn = 1,
        [EnumMember]
        Info = 0
    }

    public interface ILoggingService
    {
        void LogEvent(LogEventType type, string source, int id, string message, Exception exceptionInfo);
    }

    public static class LoggingServiceExtensions
    {
        public static void LogEvent(this ILoggingService log, LogEventType type, string source, int id, string message)
        {
            if (log == null) throw new ArgumentNullException("log");

            log.LogEvent(type, source, id, message, null);
        }

        public static void Info(this ILoggingService log, string source, string message)
        {
            if (log == null) throw new ArgumentNullException("log");

            log.LogEvent(LogEventType.Info, source, 0, message);
        }

        public static void Warn(this ILoggingService log, string source, string message)
        {
            if (log == null) throw new ArgumentNullException("log");

            log.LogEvent(LogEventType.Warn, source, 0, message);
        }
    }


}
